package com.wanmait.deliverymangementsystem.managecontroller;

import com.wanmait.deliverymangementsystem.service.OrdersService;
import com.wanmait.deliverymangementsystem.service.UsersService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
@RequestMapping("manage")
public class MangeStatisticController {
    @Resource
    private UsersService usersService;
    @Resource
    private OrdersService ordersService;
    @GetMapping("statistics")
    public void statistics(Model model){
        Integer userNumber =usersService.userNumber();
        Integer orderNumber = ordersService.findAllOrder();
        Integer comOrderNumber =ordersService.findCompleteOrder();
        model.addAttribute("userNumber",userNumber);
        model.addAttribute("orderNumber",orderNumber);
        model.addAttribute("comOrderNumber",comOrderNumber);
    }
}
